package com.controller;


import com.domain.Audit;
import com.domain.Resume;
import com.domain.Student;
import com.domain.Teacher;
import com.service.AuditService;
import com.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/audit")
public class AuditController {
    @Autowired
    private AuditService auditService;

    @PostMapping("/increase")
    public ModelAndView increase(Audit audit, HttpSession session) {
        ModelAndView modelAndView = new ModelAndView();
        Teacher teacher = (Teacher) session.getAttribute("audit");
        audit.setSid(teacher.getTid());
        auditService.increase(audit);
        modelAndView.setViewName("teacher_grade");
        return modelAndView;
    }
}
